<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>父子组件toDoList</title>
		<script src="https://cdn.jsdelivr.net/npm/vue"></script>
		<style>
			li{
				cursor: pointer;
			}
		</style>
	</head>
	<body>
		<div id="app">
			<input type="text" v-model="info"/> 
			<button @click="reduce()">add</button>
			<ul>
				<todoitem v-for="item in arr" :item="item"></todoitem>
			</ul>
		</div>
		<script>
			Vue.component('todoitem',{
				props:['item'],
				template:'<li>{{item}}</li>'
			})
			var vm = new Vue({
				el:'#app',
				data:{
					info:'',
					arr:[]
				},
				methods:{
					reduce:function(){
						 this.arr.push(this.info);
						 this.info='';
					}
				}
			})
		</script>
	</body>
</html>

